<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/5/3
 * Time: 15:12
 */
namespace app\common\model;

use think\Model;

class Paylog extends Model
{
    /*
       * 写入支付异步log日志
       * $tyep 类型 ,0支付成功,1验签失败,2事务失败,3小程序红包
       */
    public static function writeLog($status,$uid,$logDataStr,$out_trade_no,$type,$reason=''){
        switch ($status){
            case 0:case 3:
            self::create(['uid'=>$uid,'type'=>$type,'queryParams'=>$logDataStr,'result'=>$reason,'create_time'=>time(),'out_trade_no'=>$out_trade_no,'status'=>$status]);
            break;
            case 1:
                self::create(['uid'=>$uid,'type'=>$type,'queryParams'=>$logDataStr,'out_trade_no'=>$out_trade_no,'result'=>'验签失败','create_time'=>time(),'status'=>$status]);
                break;
            default:
        }
    }
}